package ru.javadevelop.homefinans.svc;

import com.neurospeech.wsclient.*;
import org.w3c.dom.*;

public class HomeFinansService extends SoapWebService{
	
	
	public HomeFinansService(){
		this.setUrl("/HomeFinansService.svc/HomeFinansService.svc");
	}
	
	protected String getNamespaces()
	{
		return 
		" xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" \r\n" + 
		" xmlns:xsd=\"http://www.w3.org/2001/XMLSchema\" \r\n" + 
		" xmlns:soap=\"http://schemas.xmlsoap.org/soap/envelope/\" \r\n" + 
		" xmlns:ns4=\"http://schemas.datacontract.org/2004/07/HomeFinans.Models\" \r\n" + 
		" xmlns:ns5=\"http://schemas.microsoft.com/2003/10/Serialization/\" \r\n" + 
		" xmlns:ns6=\"http://tempuri.org/\" \r\n" + 
		 "" ;
	}
	
	protected void appendNamespaces(Element e)
	{
		e.setAttribute("xmlns:xsi", "http://www.w3.org/2001/XMLSchema-instance");
		e.setAttribute("xmlns:xsd", "http://www.w3.org/2001/XMLSchema");
		e.setAttribute("xmlns:soap", "http://schemas.xmlsoap.org/soap/envelope/");
		e.setAttribute("xmlns:ns4", "http://schemas.datacontract.org/2004/07/HomeFinans.Models");
		e.setAttribute("xmlns:ns5", "http://schemas.microsoft.com/2003/10/Serialization/");
		e.setAttribute("xmlns:ns6", "http://tempuri.org/");
	}
	
	
	public String SendCost(Cost cost) throws Exception 
	{
		SoapRequest ___req = buildSoapRequest("http://tempuri.org/IHomeFinansService/SendCost");
		WSHelper ws = new WSHelper(___req.document);
		HomeFinansService_SendCost ____method = new HomeFinansService_SendCost();
		____method.setcost(cost);
		___req.method = ____method.toXMLElement(ws,___req.root);
		SoapResponse sr = getSoapResponse(___req);
		if(sr.header!=null)
		{
		}
		HomeFinansService_SendCostResponse __response = HomeFinansService_SendCostResponse.loadFrom((Element)sr.body.getFirstChild());
		return  __response.getSendCostResult();
	}
	
	public String SendCosts(ArrayOfCost costs) throws Exception 
	{
		SoapRequest ___req = buildSoapRequest("http://tempuri.org/IHomeFinansService/SendCosts");
		WSHelper ws = new WSHelper(___req.document);
		HomeFinansService_SendCosts ____method = new HomeFinansService_SendCosts();
		____method.setcosts(costs);
		___req.method = ____method.toXMLElement(ws,___req.root);
		SoapResponse sr = getSoapResponse(___req);
		if(sr.header!=null)
		{
		}
		HomeFinansService_SendCostsResponse __response = HomeFinansService_SendCostsResponse.loadFrom((Element)sr.body.getFirstChild());
		return  __response.getSendCostsResult();
	}

    public ArrayOfCategory GetCategories(String username) throws Exception
    {
        SoapRequest ___req = buildSoapRequest("http://tempuri.org/IHomeFinansService/GetCategories");
        WSHelper ws = new WSHelper(___req.document);
        HomeFinansService_GetCategories ____method = new HomeFinansService_GetCategories();
        ____method.setusername(username);
        ___req.method = ____method.toXMLElement(ws,___req.root);
        SoapResponse sr = getSoapResponse(___req);
        if(sr.header!=null)
        {
        }
        HomeFinansService_GetCategoriesResponse __response = HomeFinansService_GetCategoriesResponse.loadFrom((Element)sr.body.getFirstChild());
        return  __response.getGetCategoriesResult();
    }
	
}
